
#include "FreeRTOS.h"
#include "task.h"
#include "communication.h"
#include "sense_manager.h"
#include "sense_485.h"
#include "config.h"
#include "sim7600ce.h"
void vSense_Task( void *pvParameters )
{
	PT_SenseOpr ptInfrSense;
	PT_SenseOpr ptVibratorSense;
	
	EventBits_t AllEventBit = 0;
	
	ptInfrSense     = GetSenseOpr("infraredtemp");
	ptVibratorSense = GetSenseOpr("vibrator");
	
	Sense_485_Init(9600);
	
	while(1)
	{
		AllEventBit = xEventGroupWaitBits(TCPEventGroupHandler, \
											VIBRATOR_DATABIT | INFRAREDTEMP_DATABIT,\
											pdFALSE,pdFALSE,portMAX_DELAY);

		vTaskDelay(100);
		if(AllEventBit | INFRAREDTEMP_DATABIT)
		{
			ptInfrSense->GetData();
			ptInfrSense->ReportData();
			xEventGroupClearBits(TCPEventGroupHandler, INFRAREDTEMP_DATABIT);
		}
		if(AllEventBit | INFRAREDTEMP_DATABIT)
		{
			ptVibratorSense->GetData();
			ptVibratorSense->ReportData();
			xEventGroupClearBits(TCPEventGroupHandler, VIBRATOR_DATABIT);
		}
		
	}
}

